# Contributor: Bhushan Shah <bshah@kde.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=libphonenumber
pkgver=8.12.44
pkgrel=7
pkgdesc="Library for parsing, formatting, and validating international phone numbers."
url="https://github.com/google/libphonenumber"
arch="all"
license="Apache-2.0"
depends_dev="
	abseil-cpp-dev
	boost-dev
	icu-dev
	protobuf-dev
	"
makedepends="$depends_dev
	cmake
	gtest-dev
	ninja
	"
checkdepends="gtest icu-data-full"
subpackages="$pkgname-static $pkgname-dev"
source="https://github.com/google/libphonenumber/archive/v$pkgver/libphonenumber-v$pkgver.tar.gz
	cmake-duplicate-rule-definition.patch
	system-abseil.patch
	c++17.patch
	"

build() {
	cd cpp
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DREGENERATE_METADATA=OFF
	cmake --build build
}

check() {
	cd cpp
	./build/libphonenumber_test
}

package() {
	cd cpp
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
3343fb1f8a41d4fcd056de3d6a66ab938a81fde7f006d8e9805a4903d9779fd781cdab779649b75efe8860ff979df60b386afdc2c0aab5e66a350ce723a6371e  libphonenumber-v8.12.44.tar.gz
dc76f0649c401ec97a7449373b96247135c3b80cf1e5bb8afba005fed1055a74429d3c778b7519b609bdcfbb278be395ef83e0bd00228239b6f15d96b0d2df11  cmake-duplicate-rule-definition.patch
b6d2eed233817810676a74c50533968029784b4ea0e16c45a31520e5bb5965518455ec0b2e0ef61c652ce52b840b9d6514b0a26c4941056a7dbff359303610d8  system-abseil.patch
12aa540caf28e7b6a6ab93c8ddc60753f4ced446f4763ca87809218cdac8209cdc2c3c82b8efda563130b178de14d3c0f9e87f0c7108dddd63c211089ee8331c  c++17.patch
"
